namespace ThirdLife.Render.MogrePlugin.Common
{
  public class RenderingEngineController : IRenderingEngineController, IRenderingViewAdapter, IMetaverseModelAdapter
  {
    private IMetaverseModel _model;
    private IRenderingView _view;

    public RenderingEngineController(IRenderingView view, IMetaverseModel model)
    {
      _model = model;
      _view = view;
      _model.SetAdapter(this as IRenderingViewAdapter);
      _view.SetAdapter(this as IMetaverseModelAdapter);
    }

    public ICamera ActiveCamera
    {
      get { throw new System.NotImplementedException(); }
      set { throw new System.NotImplementedException(); }
    }

    public void StartRendering()
    {
      _view.StartRendering();
    }

    public void StopRendering()
    {
      _view.StopRendering();
    }

    public void Setup()
    {
      _view.Setup();
    }

    #region IMetaverseModelAdapter Members

    public void ProcessIncomingAvatars(OpenViewer.Models.AddNewEntity sceneAddAvatar)
    {
      _model.ProcessIncomingAvatars(sceneAddAvatar);
    }

    public void ProcessIncomingPrim(OpenViewer.Models.AddNewEntity sceneAddPrim)
    {
      _model.ProcessIncomingPrim(sceneAddPrim);
    }

    public void ProcessLand(AddTerrainHandler handler)
    {
      _model.ProcessLand(handler);
    }

    #endregion
  }
}